package com.pl.myshop.provider.service;

import com.pl.myshop.provider.api.RegService;
import com.pl.myshop.provider.domain.UmsAdmin;
import com.pl.myshop.provider.mapper.UmsAdminMapper;
import org.apache.dubbo.config.annotation.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * @Auther: pl
 * @Date: 2020/3/21 22:07
 * @Description:
 */
@Service(version = "1.0.0")
public class RegServiceImp implements RegService {
    //notice3 注意这里用resource，线程安全，不用auto，
    @Resource
    private UmsAdminMapper umsAdminMapper;

    @Override
    public int regInsert(UmsAdmin umsAdmin) {
        return umsAdminMapper.insert(umsAdmin);
    }

    @Override
    public UmsAdmin get(String username) {
        Example example = new Example(UmsAdmin.class);
        example.createCriteria().andEqualTo("username", username);
        return umsAdminMapper.selectOneByExample(example);
    }
}